<extend name="Layout:layout_dialog" />
<block name="body_main">    
    <form action="{:U('appointment_edit_save')}" method="post" class="xsui-form">
        <fieldset>
            <div class="xsui-form-field">
                <label>客户：</label>
                {$data.name} ({$data.serial_no})
            </div>
            <div class="xsui-form-field">
                <label>预约时间：</label>
                <input type="text" name="appointment_time" placeholder="预约时间" value="{$data.appointment_time}" class="datetimepicker" />
            </div>
            <div class="xsui-form-field">
                <label>预约备注：</label>
                <input type="text" name="appointment_remark" value="{$data.appointment_remark}" size="32" placeholder="预约备注" />
            </div>
            <if condition="$data['id'] neq ''">
                <div class="xsui-form-field">
                    <label>回访状态：</label>
                    <sohtml:radio name="status" items="0:未回访;1:回访成功;2:回访失败;4:放弃回访" value="{$data.status}" />
                </div>
                <div class="xsui-form-field">
                    <label>回访时间：</label>
                    <input type="text" name="review_time" placeholder="回访时间" value="{$data.review_time}" class="datetimepicker" />
                </div>
                <div class="xsui-form-field">
                    <label>回访结果：</label>
                    <input type="text" name="review_result" value="{$data.review_result}" size="32" placeholder="回访结果" />
                </div>
            </if>
        </fieldset>
        <button type="submit" class="ui-state-default"><i class="fa fa-save"></i>保存</button>
        <button type="reset" class="ui-state-default">重置</button>
        <input type="hidden" name="id" value="{$data.id}"/>
        <input type="hidden" name="customer_id" value="{$data.customer_id}"/>
    </form>
    <fieldset>
        <legend>预约记录</legend>
        <div style="max-height:280px; width:750px; overflow-y: auto">            
            <table class="xsui-table-bordered" width="100%">
                <tr><th>预约时间</th><th>预约备注</th><th>回访时间</th><th>回访结果</th><th>状态</th><th>操作</th></tr>
                <foreach name="list" item="vo">
                    <tr>
                        <td>{$vo.appointment_time}</td>
                        <td><div class="xsui-text-ellipsis" style="width:120px;">{$vo.appointment_remark}</div></td>
                        <td>{$vo.review_time}</td>
                        <td><div class="xsui-text-ellipsis" style="width:120px;">{$vo.review_result}</div></td>
                        <td>{$vo.status|sofn_get_state_text='customer-appointment-status',###}</td>
                        <td><a href="{:U('appointment_edit','id='.$vo['id'].'&customer_id='.$vo['customer_id'])}" class="xsui-btn ui-state-default">编辑</a></td></tr>
                </foreach>
            </table>
        </div>
    </fieldset>
</block>
<block name="body_after">
    <script type="text/javascript">
        // 复用资源,减少流量
        $('.xsui-text-ellipsis').hover(function () {
            $(this).attr('title', $(this).text());
        })
    </script>
</block>